package cn.progen.generator;


import cn.progen.constant.Config;
import cn.progen.model.Table;
import cn.progen.util.FreemarkerUtil;

import java.util.HashMap;

import java.util.List;
import java.util.Map;



public class MapperXmlGenerator extends Generator {

	@Override
	public void out(List<Table> taList) {
		taList.forEach(item->{
			FreemarkerUtil freemarkerUtil=new FreemarkerUtil(Config.Path.getMapperxmlurl(), item.getClassName()+"Mapper.xml");
			Map dataMap=new HashMap<>();
			dataMap.put("table", item);
			dataMap.put("basepackage", Config.Path.MODELURL);
			dataMap.put("mapperpack",Config.Path.MAPPERURL);
			freemarkerUtil.createDoc(dataMap, "Mapper.xml.ftl");
		});
	}

}
